<template>
  <div>
    <a-form-item
      label="审核结果:"
      :field="approveField"
      :required="required"
      :rules="[ {required: required, message: '征象必填项不能为空！'} ]"
      class="form-item"
    >
      <a-textarea
        v-if="type === 'text'"
        v-model="form[approveField]"
        allow-clear
        :disabled="disabled"
        @change="($event: string | number | Record<string, any> | (string | number | Record<string, any>)[]) => handleChange($event, item)"
      />
      <a-select
        v-if="type === 'select'"
        placeholder="请选择"
        allow-clear
        v-model="form[approveField]"
        :disabled="disabled"
        @change="($event: any) => handleChange($event, item)"
      >
        <a-option v-for="it in options" :key="it?.value" :value="it?.value">{{
          it?.label
        }}</a-option>
      </a-select>
      <a-radio-group
        v-if="type === 'radiobox'"
        v-model="form[approveField]"
        :disabled="disabled"
        @change="($event: string | number | boolean) => handleChange($event, item)"
      >
        <a-grid :cols="3" :colGap="24" :rowGap="16">
          <a-grid-item v-for="it in options" :key="it?.value">
            <a-radio :value="it?.value">{{ it?.label }}</a-radio>
          </a-grid-item>
        </a-grid>
      </a-radio-group>
      <a-checkbox-group
        v-if="type === 'checkbox'"
        v-model="form[approveField]"
        :disabled="disabled"
        @change="($event: string | number | Record<string, any> | (string | number | Record<string, any>)[]) => handleChange($event, item)"
      >
        <a-grid :cols="3" :colGap="24" :rowGap="16">
          <a-grid-item v-for="it in options" :key="it?.value">
            <a-checkbox :value="it?.value">{{ it?.label }}</a-checkbox>
          </a-grid-item>
        </a-grid>
      </a-checkbox-group>
      <a-cascader
        v-if="type === 'child_select'"
        v-model="form[approveField]"
        path-mode
        :options="options"
        class="cascader"
        placeholder="请选择"
        allow-clear
        :disabled="disabled"
        @change="($event: string | number | Record<string, any> | (string | number | Record<string, any> | (string | number | Record<string, any>)[])[] | undefined) => handleChange($event, item)"
      />
    </a-form-item>
  </div>
</template>
<script lang="ts" setup name="FormItem">
import Props from "../props/formItem";
const props = defineProps(Props);
const emit = defineEmits(["update:handleChange"]);
const handleChange = (value: any, item: any) => {
  emit("update:handleChange", { value, item });
};
</script>
<style lang="less" scoped>
.form-item {
  margin-bottom: 0px;
  padding: 12px;
  border-bottom: 1px solid #000;
  :deep(.arco-form-item-label-col) {
    .arco-form-item-label {
      color: #ccc;
    }
  }
  :deep(.arco-form-item-wrapper-col) {
    .arco-textarea-wrapper {
      background: transparent;
      border: 1px solid rgba(255, 255, 255, 0.7);
      border-radius: 4px;
      color: #ccc;
    }
    .arco-select-view-single {
      background: transparent;
      border-color: rgba(255, 255, 255, 0.7);
      border-radius: 4px;
      color: #ccc;
      .arco-select-view-suffix {
        color: #ccc;
      }
    }
    .arco-grid {
      gap: 16px 0px !important;
      grid-template-columns: repeat(2, 50%) !important;
    }
    .arco-radio-label,
    .arco-checkbox-label {
      color: #ccc;
      user-select: none;
    }
    .arco-radio-group,
    .arco-checkbox-group {
      width: 100%;
    }
    .arco-icon-hover:hover {
      color: #13fffb;
    }
    .arco-icon-hover:hover::before {
      background: transparent;
    }
    .arco-checkbox-checked {
      .arco-checkbox-icon {
        background-color: #67c9d5;
      }
    }
    .arco-icon-hover:hover::before {
      background-color: transparent;
    }
    .arco-icon-hover:hover {
      .arco-checkbox-icon {
        border: 1px solid #67c9d5;
      }
    }
    .arco-checkbox:hover {
      .arco-checkbox-icon-hover::before {
        background-color: transparent;
      }
    }
    .arco-radio-icon {
      width: 12px;
      height: 12px;
      line-height: 12px;
      border: 1px solid rgba(255, 255, 255, 0.7);
    }
    .arco-radio-icon::after {
      background-color: transparent;
    }
    .arco-radio:hover .arco-radio-icon {
      border-color: #67c9d5;
    }
    .arco-radio:hover .arco-radio-icon-hover::before {
      background-color: transparent;
    }
    .arco-radio-checked .arco-radio-icon {
      border: 1px solid #67c9d5;
      background-color: transparent;
    }
    .arco-radio-checked .arco-radio-icon::after {
      background-color: #67c9d5;
    }
    .arco-checkbox > input[type="checkbox"]:focus + .arco-checkbox-icon-hover::before {
      background-color: transparent;
    }
  }
}
.other-item {
  padding-top: 0;
}
</style>
